package cn.edu.seu.ssny.dao;

import cn.edu.seu.ssny.dao.support.IBaseDao;
import cn.edu.seu.ssny.entity.*;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface IEquipmentDao extends IBaseDao<Equipment, Integer> {
    Optional<Equipment> findByName(String name);

    @Query(value = "select * from tb_equipment where project_id=?1", nativeQuery = true)
    List<Equipment> findEquipmentsByProjectId(Integer projectId);

    List<Equipment> findByProject(Project project);

    List<Equipment> findByEnterprise(Enterprise enterprise);

    @Query(value = "select * from tb_equipment where sysclass_id=?1", nativeQuery = true)
    List<Equipment> findBySysClassId(Long sysClassId);
}
